#include<iostream>
#include<string>
using namespace std;
string s;
int main()
{
	cin >> s;
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '{') {
			cnt++;
		}
		else if (s[i] == '}') {
			continue;
		}
		else if (s[i] == ',') {
			cout << " " << cnt << endl;
			cnt = 0;
			continue;
		}
		else {
			cout << s[i];
		}
	}
	cout << " " << cnt << endl;
	return 0;
}